#include <bits/stdc++.h>

#define PSI pair<string,int>
#define PII pair<int,int>
#define VVI vector<vector<int>>
#define VI vector<int>
#define VS vector<string>

#define PQLI priority_queue<int, vector<int>, less<int>>
#define PQGI priority_queue<int, vector<int>, greater<int>>
#define i64 long long

using namespace std;

const int N = 1e5 + 5;
i64 ans;

void solve() {
    int n,m;
    cin >> n >> m;
    int x;
    map<int,int> mp;
    for(int i = 0 ; i < n ; i ++){
        cin >> x;
        mp[x] ++;
    }
    for(int i = 1; i < m; i ++){
        int x = mp.find(i);
        int y =  mp.find(i + 1);
        if( x != mp.end() && y != mp.end()){
            ans = max(x.second * x.first )
        }
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int T = 1;
//    cin >> T;
    while (T--) solve();
//    cout << "\n"[];
    return 0;
}